/* sd-forge-mobile-stability-CLAUDE Stylesheet */

/* 1. iOS Safari Momentum Scrolling & Layout Isolation */
.mobile-safari-optimized {
    -webkit-overflow-scrolling: touch !important;
}

.mobile-safari-optimized * {
    -webkit-tap-highlight-color: transparent !important;
}

/* 2. Resilient Progress Bar Polish */
.progressDiv.mobile-resilient {
    position: absolute;
    height: 22px;
    background: #b4c0cc;
    border-radius: 4px !important;
    top: -16px;
    left: 0px;
    width: 100%;
    overflow: visible;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.dark .progressDiv.mobile-resilient {
    background: #2b333e;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.progressDiv.mobile-resilient .progress {
    min-width: 3.5rem;
    height: 22px;
    background: #0060df;
    color: #ffffff;
    font-weight: 600;
    font-size: 11px;
    line-height: 22px;
    text-align: right;
    border-radius: 4px;
    overflow: visible;
    white-space: nowrap;
    padding: 0 0.6em;
    transition: width 0.25s ease-out;
    box-sizing: border-box;
}

/* 3. Zero-GC Recycled Live Preview Container */
.livePreview.mobile-recycled {
    position: absolute;
    z-index: 300;
    background: var(--background-fill-primary, #ffffff);
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.livePreview.mobile-recycled img {
    max-width: 100%;
    max-height: calc(100% - 60px);
    object-fit: contain;
}

/* 4. Generation Infotext & Metadata Clean High-Contrast Styling */
/* Enforces crisp white font (#f3f4f6) across ALL themes, states, and recovery paths */
#html_info_txt2img,
#html_info_txt2img *,
#html_info_img2img,
#html_info_img2img *,
#html_info_extras,
#html_info_extras *,
#html_log_txt2img,
#html_log_txt2img *,
#html_log_img2img,
#html_log_img2img *,
#html_log_extras,
#html_log_extras *,
.infotext,
.infotext *,
.infotext p,
.infotext span,
.html-log,
.html-log *,
.html-log p,
.html-log span,
[id^="html_info_"],
[id^="html_info_"] *,
[id^="html_info_"] p,
[id^="html_log_"],
[id^="html_log_"] *,
[id^="html_log_"] p,
#generation_info_txt2img,
#generation_info_txt2img *,
#generation_info_img2img,
#generation_info_img2img * {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

#html_info_txt2img p,
#html_info_img2img p,
#html_info_extras p,
#html_log_txt2img p,
#html_log_img2img p,
#html_log_extras p,
.infotext p,
.html-log p,
[id^="html_info_"] p,
[id^="html_log_"] p {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
    margin: 0.25em 0 !important;
    font-size: 0.88rem !important;
    line-height: 1.45 !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    opacity: 1 !important;
}

/* Force override on Gradio/Tailwind .prose containers */
.prose.infotext,
.prose.infotext *,
.prose.infotext p,
.prose[id^="html_info_"],
.prose[id^="html_info_"] *,
.prose[id^="html_info_"] p,
.prose[id^="html_log_"],
.prose[id^="html_log_"] *,
.prose[id^="html_log_"] p {
    color: #f3f4f6 !important;
    -webkit-text-fill-color: #f3f4f6 !important;
    --tw-prose-body: #f3f4f6 !important;
    --tw-prose-headings: #ffffff !important;
    --tw-prose-lead: #f3f4f6 !important;
    --tw-prose-bold: #ffffff !important;
    --tw-prose-quotes: #f3f4f6 !important;
    --tw-prose-code: #ffffff !important;
}

/* Performance metrics and execution comments in log panel */
.html-log .performance,
.html-log .performance *,
.html-log .performance p,
.html-log .performance span,
.html-log .comments,
.html-log .comments * {
    color: #e5e7eb !important;
    -webkit-text-fill-color: #e5e7eb !important;
    opacity: 1 !important;
}

/* 5. Touch-Friendly Padding for Dropdowns & Accordions on Mobile */
@media (max-width: 768px) {
    .gradio-dropdown ul.options li {
        min-height: 40px;
        display: flex;
        align-items: center;
    }

    button.primary, button.secondary, button.lg {
        min-height: 42px;
        touch-action: manipulation;
    }
}
